/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Review.test1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author THIEN
 */
public class FanDemo {

    public FanDemo() {
    }
    static FanManagement FM = new FanManagement();
    static InputStreamReader reader = new InputStreamReader(System.in);
    static BufferedReader in = new BufferedReader(reader);

    public static void menu() throws IOException {
        //init a choice
        int choice;
        do {
            System.out.println("\t1. Input fan's data");
            System.out.println("\t2. Save to file");
            System.out.println("\t3. Read from file");
            System.out.println("\t4. Search");
            System.out.println("\t5. Exit");
            System.out.print("Enter your choice: ");
            choice = Integer.parseInt(in.readLine());

            switch (choice) {
                case 1:
                    FM.inputData();
                    break;
                case 2:
                    FM.Save2file();
                    break;
                case 3:
                    FM.readFromFile();
                    break;
                case 4:
                    FM.searchData();
                    break;
                case 5:
                    break;
            }
        } while (choice != 5);
    }
    public static void main(String arg[]) throws IOException{
        FanDemo FM = new FanDemo();
        FM.menu();
    }
    
}
